package com.qin.controller;

import com.alibaba.fastjson.JSONObject;
import com.qin.entity.Version;
import com.qin.service.VerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller("verController")
@RequestMapping("/ver")
@ResponseBody
public class VerController {

    @Autowired
    VerService verService;

    @RequestMapping(value="/queryVersions", produces="application/json;charset=UTF-8")
    public String queryVersions(@RequestBody String body){
//        System.out.println("web层：queryVersions");
        System.out.println("接口调用：/ver/queryVersions");

        //入参封装到实体类
        Version version = JSONObject.parseObject(body, Version.class);
        System.out.println("接口入参：" + body);
        //调用service层
        String retString = verService.queryVersions(version).toString();

        System.out.println("接口出参：" + retString);
        return retString;
    }
}
